package oop3;

/**
 * @author oldliu
 * @since 1.0
 */
//教务处，算平均分
public class Calc {
    public int calcAvg1(int java, int sql, int csharp) {
        if (java < 60) {
            java += 20;
        }
        System.out.println("这三门课成绩分别是：" + java + "," + sql + "," + csharp);

        int avg = (java + sql + csharp) / 3;

        return avg;
    }

    public int calcAvg2(Student s) {
        //给java涨分
        if (s.java < 60) {
            s.java += 20;
        }
        s.showInfo();
        int avg = (s.java + s.sql + s.csharp) / 3;

        return avg;
    }
    //计算一组学生的java平均分
    public int calcJavaAvg3(Student[] sr) {
        int total=0;
        for (int i = 0; i < sr.length; i++) {
            total+=sr[i].java;
        }
//        for(Student s:sr){
//            total+=s.java;
//        }
        return total/sr.length;
    }
}
